﻿Public Class IngresarClientes
    Inherits System.Web.UI.Page
    Dim c As New Conexion
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("VariableNombre") = Nothing Then
            Label1.Text = "Tienes que Logearte"
            btnLogout.Visible = False
        Else
            HyperLink1.Visible = False
            Label2.Text = "Bienvenido " + Session("VariableNombre").ToString()

            c.SeleccionarLetras(TextBox6, "select nombres from usuarios where login='" & Session("VariableNombre").ToString() & "'")
            Label2.Text = "Bienvenido " + TextBox6.Text


        End If
    End Sub

    Protected Sub btnLogout_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLogout.Click
        Session("VariableNombre") = Nothing
        Response.Redirect("InicioSesion.aspx")
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        Dim nombres As String = TextBox1.Text
        Dim direccion As String = TextBox2.Text
        Dim telefono As String = TextBox3.Text
        Dim celular As String = TextBox4.Text
       
        Dim sentencia As String = "insert into clientes values('" & nombres & "','" & direccion & "', '" & telefono & "', '" & celular & "')"
        c.Insertar_Actualizar_Eliminar(sentencia, "insertados")
        Label1.Text = Conexion.msj_sql_server

    End Sub
End Class